<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Array</title>
    <script>
        let numbers = [1, 2, 3, 4, 5, 4, 3, 2, 1];
        let everyResult = numbers.every(function (item) {
            return (item > 2);
        });
        alert(everyResult);//false

        let someResult = numbers.some(function (item) {
            return (item > 2);
        });
        alert(someResult);//true

        let filterResult = numbers.filter(function (item) {
            return (item > 2);
        });
        alert(filterResult);//3,4,5,4,3

        let forEachResult = numbers.forEach(function (item) {
            //执行某些操作
            let newItem = item + 1;
        });

        let mapResult = numbers.map(function (item) {
            return item * 2;
        });
        alert(mapResult);//2,4,6,8,10,8,6,4,2


    </script>
</head>
<body>
迭代方法
</body>
</html>